package com.crazy.web.config.mq.rabbitmq;

import ch.qos.logback.core.net.SMTPAppenderBase;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author zhaochaofeng
 * @version 1.0
 * @date 2021/1/7 16:19
 */
//@Log4j2
//@Configuration
//@EnableConfigurationProperties(RabbitMqEntity.class)
//public class RabbitMqConnectionUtil {
//
//    @Autowired
//    private RabbitMqEntity rabbitMqEntity;
//
//    @Bean
//    public ConnectionFactory connectionFactory() {
//        //定义连接工厂
//        ConnectionFactory factory = new ConnectionFactory();
//        //设置服务地址
//        factory.setHost(rabbitMqEntity.getLocalhost());
//        //端口
//        factory.setPort(rabbitMqEntity.getPort());
//        //设置账号信息，用户名、密码、vhost
//        factory.setVirtualHost(rabbitMqEntity.getVhost());
//        factory.setUsername(rabbitMqEntity.getUserName());
//        factory.setPassword(rabbitMqEntity.getPassword());
//        return factory;
//    }
//
//}
